package com.service;

import java.util.List;

public class LaserPrinter implements Printer  {

    private  Ink ink;

    private List<Paper> paperList;

    public List<Paper> getPaperList() {
        return paperList;
    }

    public void setPaperList(List<Paper> paperList) {
        this.paperList = paperList;
    }

    @Override
    public void print(String info, int count, String type) {

        Paper paper = null;

        for (int i = 0; i < paperList.size(); i++) {
            //类型判断
            if (type.equals(paperList.get(i).getType())){
                paper = paperList.get(i);
            }
        }
        if (paper !=null){
            for (int i = 0; i < count ; i++) {
                String msg = String.format("使用%s(%s)打印第%d份，内容：%s",type,paper.getSize(),(i+1),info);
                System.out.println(msg);
            }
        }



    }

    public Ink getInk() {
        return ink;
    }

    public void setInk(Ink ink) {
        this.ink = ink;
    }
}
